import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';

// import { BullModule } from '@nestjs/bull';
// import { ConfigModule, ConfigService } from '@nestjs/config';
import {
  ROOT_ROLE_ID,
  // SYS_TASK_QUEUE_NAME,
  // SYS_TASK_QUEUE_PREFIX,
} from '@main/service/modules/admin/admin.constants';

// import SysDepartment from '@main/entities/service/admin/sys/sys-department.entity';
import SysLoginLog from '@main/entities/service/admin/sys/sys-login-log.entity';
import SysMenu from '@main/entities/service/admin/sys/sys-menu.entity';

// import SysRoleDepartment from '@main/entities/service/admin/sys/sys-role-department.entity';
import SysRoleMenu from '@main/entities/service/admin/sys/sys-role-menu.entity';
import SysRole from '@main/entities/service/admin/sys/sys-role.entity';
import SysTaskLog from '@main/entities/service/admin/sys/sys-task-log.entity';
import SysTask from '@main/entities/service/admin/sys/sys-task.entity';
import SysUserRole from '@main/entities/service/admin/sys/sys-user-role.entity';
import SysUser from '@main/entities/service/admin/sys/sys-user.entity';

// import { WSModule } from 'src/modules/ws/ws.module';
import SysConfig from '@main/entities/service/admin/sys/sys-config.entity';
import SysPageColumn from '@main/entities/service/admin/sys/sys-page-column.entity';
import SysDictionary from '@main/entities/service/admin/sys/sys-dictionary.entity';
import SysDictionaryType from '@main/entities/service/admin/sys/sys-dictionary-type.entity';
import SysLabelTemplate from '@main/entities/service/admin/sys/sys-label-template.entity';
import SysOperationLog from '@main/entities/service/admin/sys/sys-operation-log.entity';
import { rootRoleIdProvider } from '../core/provider/root-role-id.provider';

// import { SysDeptController } from './dept/dept.controller';
// import { SysDeptService } from './dept/dept.service';
import { SysLogController } from './log/log.controller';
import { SysLogService } from './log/log.service';
import { SysMenuController } from './menu/menu.controller';
import { SysMenuService } from './menu/menu.service';
import { SysRoleController } from './role/role.controller';
import { SysRoleService } from './role/role.service';
import { SysUserController } from './user/user.controller';
import { SysUserService } from './user/user.service';

// import { SysTaskController } from './task/task.controller';
// import { SysTaskService } from './task/task.service';
// import { SysTaskConsumer } from './task/task.processor';
// import { SysOnlineController } from './online/online.controller';
// import { SysOnlineService } from './online/online.service';
import { SysParamConfigController } from './paramConfig/paramConfig.controller';
import { SysParamConfigService } from './paramConfig/paramConfig.service';

// import { SysServeController } from './serve/serve.controller';
// import { SysServeService } from './serve/serve.service';
// import { ConfigurationKeyPaths } from './../../../../../config/configuration';
import { SysPageColumnController } from './pageColumn/pageColumn.controller';
import { SysPageColumnService } from './pageColumn/pageColumn.service';
import { SysDictionaryService } from './dictionary/dictionary.service';
import { SysDictionaryController } from './dictionary/dictionary.controller';
import { SysLabelTemplateService } from './labelTemplate/labelTemplate.service';
import { SysLabelTemplateController } from './labelTemplate/labelTemplate.controller';
import { SysOperationLogService } from './operationLog/operationLog.service';
import { SysOperationLogController } from './operationLog/operationLog.controller';
import SysErpField from '@main/entities/service/admin/sys/sys-erp-field.entity';
import { SysErpFieldController } from './erpField/erpField.controller';
import { SysErpFieldService } from './erpField/erpField.service';

@Module({
  imports: [
    TypeOrmModule.forFeature([
      SysUser,
      // SysDepartment,
      SysUserRole,
      SysMenu,
      SysRoleMenu,
      SysRole,
      // SysRoleDepartment,
      SysUserRole,
      SysLoginLog,
      SysTask,
      SysTaskLog,
      SysConfig,
      SysPageColumn,
      SysDictionary,
      SysDictionaryType,
      SysLabelTemplate,
      SysOperationLog,
      SysErpField
    ]),
    // BullModule.registerQueueAsync({
    //   name: SYS_TASK_QUEUE_NAME,
    //   imports: [ConfigModule],
    //   useFactory: (configService: ConfigService<ConfigurationKeyPaths>) => ({
    //     redis: {
    //       host: configService.get<string>('redis.host'),
    //       port: configService.get<number>('redis.port'),
    //       password: configService.get<string>('redis.password'),
    //       db: configService.get<number>('redis.db'),
    //     },
    //     prefix: SYS_TASK_QUEUE_PREFIX,
    //   }),
    //   inject: [ConfigService],
    // }),
    // WSModule,
  ],
  controllers: [
    SysUserController,
    SysRoleController,
    SysMenuController,
    // SysDeptController,
    SysLogController,
    // SysTaskController,
    // SysOnlineController,
    SysParamConfigController,
    // SysServeController,
    SysPageColumnController,
    SysDictionaryController,
    SysLabelTemplateController,
    SysOperationLogController,
    SysErpFieldController
  ],
  providers: [
    rootRoleIdProvider(),
    SysUserService,
    SysRoleService,
    SysMenuService,
    // SysDeptService,
    SysLogService,
    // SysTaskService,
    // SysTaskConsumer,
    // SysOnlineService,
    SysParamConfigService,
    // SysServeService,
    SysPageColumnService,
    SysDictionaryService,
    SysLabelTemplateService,
    SysOperationLogService,
    SysErpFieldService
  ],
  exports: [
    ROOT_ROLE_ID,
    TypeOrmModule,
    SysUserService,
    SysMenuService,
    SysLogService,
    SysParamConfigService,
    SysLabelTemplateService,
    SysOperationLogService,
    // SysOnlineService,
  ],
})
export class SystemModule {}
